package com.xiaoran.RMQ_1.test9_youxji;

import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.DeliverCallback;
import com.rabbitmq.client.Delivery;
import com.xiaoran.RMQ_1.utlis.RabbitMqUtils;

public class Consumer {
    public static final  String QUEUE_NAME="xiaoran";
    public static void main(String args[]) throws Exception{
        Channel channel=RabbitMqUtils.getChannel();
        DeliverCallback deliverCallback=(String consumerTag, Delivery message)->{
            System.out.println("收到消息为："+new String(message.getBody()));
        };
        CancelCallback cancelCallback=consumerTag->{ };
        channel.basicConsume(QUEUE_NAME,true,deliverCallback,cancelCallback);
    }
}
